#include <bits/stdc++.h>

using namespace std;

class Solution {
public:
	int findRadius(vector<int>& houses, vector<int>& heaters)
	{
		sort(begin(houses), end(houses));
		sort(begin(heaters), end(heaters));

		int res = 0;
		for (int i = 0, j = 0, len_i = size(houses), len_j = size(heaters);
			 i < len_i; i++) {
			int cur = abs(houses[i] - heaters[j]), next;
			while (j < len_j - 1 && cur >= (next = abs(houses[i] - heaters[j + 1]))) {
				j++;
				cur = next;
			}
			res = max(res, cur);
			/* printf("(%d,%d):%d\n)", i, j, res); */
		}

		return res;
	}

private:
};

int main()
{
	[[maybe_unused]] Solution solution;
	return 0;
}
